<?php

class Core_Agent_Component_Customer_View_Index_Index extends Core_Agent_Share_View_Grid {

    protected function buildGrid($grid) {
        $filter = new Kd_Object($this->getRequest()->getParameter('filter'));
        $grid->setId('grid')
                ->setPrimaryKey('id')
                ->setAllowFilter(TRUE)
                ->setSortField($this->getRequest()->getParameter('sort', 'id'))
                ->setSortDirection($this->getRequest()->getParameter('dir', 'asc'))
                ->setSortUrlFormat($this->getSortUrl());
        $grid->addLabelColumn($this->__('agent.label.poi_id'), 'id', '{id}')
                ->setTextboxFilter(NULL, NULL, $filter->getData('id'))
                ->setSortField('id')
                ->setWidth(140);
        $grid->addLabelColumn($this->__('agent.label.shop_name'), 'shopname', '{shop_name}')
        		->setTextboxFilter(NULL, NULL, $filter->getData('id'))
                ->setSortField('shop_name');
                
	        $grid->addLinkColumn('', 'shop', $this->getUrl(array('poiid' => '{id}'), 'edit', 'shop'), $this->__('customer.label.shop'))
	                ->setWidth(70)
	                ->setAlign('center');
	        $grid->addLinkColumn('', 'showroom', $this->getUrl(array('poiid' => '{id}'), 'index', 'showroom'), $this->__('customer.label.showroom'))
	                ->setWidth(70)
	                ->setAlign('center');

//	        $grid->addLinkColumn($this->__('agent.label.operation'), 'map', $this->getUrl(array('poiid' => '{id}'), 'edit', 'map'), $this->__('agent.label.map'))
//	                ->setWidth(70)
//	                ->setAlign('center');
//
//
//	        $grid->addLinkColumn($this->__('agent.label.operation'), 'shop', $this->getUrl(array('poiid' => '{id}'), 'edit', 'shop'), $this->__('agent.label.shop'))
//	                ->setWidth(70)
//	                ->setAlign('center');
//
//
//	        $grid->addLinkColumn($this->__('agent.label.operation'), 'product', $this->getUrl(array('poiid' => '{id}'), 'index', 'product'), $this->__('agent.label.product'))
//	                ->setWidth(50)
//	                ->setAlign('center');

        $grid->setDataSource($this->getList()->toArray());
        parent::buildGrid($grid);
    }

    protected function buildPagination($pagination) {
        $url = $this->getPaginationUrl();
        $pagination->setUrlFormat($url)->setRecordCount($this->getRecords());
        parent::buildPagination($pagination);
    }

}